<!DOCTYPE html>

<html lang="zh-CN">
    <head>
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <meta http-equiv="x-ua-compatible" content="ie=edge">
    <title>百宝库后台管理</title>
    <link rel="stylesheet" href="__PUBLIC__/admin/css/bootstrap.css">
    <link rel="stylesheet" href="__PUBLIC__/admin/css/admin.css?v=20181211_34">
    <script src="__PUBLIC__/admin/js/jquery.min.js"></script>
    <script src="__PUBLIC__/admin/js/jquery.nicescroll.js"></script>
    <script type="text/javascript">

        //菜单

        function show_leftmenu(top, url)

        {

            $(".top_menu li").removeClass("sel");

            $("#top_menu" + top).addClass("sel");

            $(".mainer_l dl").hide();

            $(".leftmenu_" + top).show();

            if (url != '')

                $("#main").attr('src', url);

        }

		

        var curr_menu = "1";

        var url_update_cache = "{:U('update_cache')}";

		

       

        //更新缓存

        function update_cache() {

            $.ajax({

                url:url_update_cache+"?n=" + Math.random(),

                success: function(val)

                {

                    alert(val);

                }

            });

        }

        

        var minHeight = $(window).height()-50;//可见窗口高度

        

        function reinitIframe() {

            var iframe = document.getElementById("main");//iframe高度

            //iframe内容页高度

            var bHeight = iframe.contentWindow.document.body.scrollHeight,

            dHeight = iframe.contentWindow.document.documentElement.scrollHeight,

            height = Math.max(bHeight,dHeight);

            if(height < minHeight)height = minHeight;

            if(height !== iframe.height) {

                iframe.height = height;

            }

        }

        function reinitIframe_init() {

            var iframe = document.getElementById("main");

            iframe.height = minHeight;

            var bHeight = iframe.contentWindow.document.body.scrollHeight,

                dHeight = iframe.contentWindow.document.documentElement.scrollHeight,

                height = Math.max(bHeight, dHeight);

            if (height < minHeight)

                height = minHeight;

            iframe.height = height;

        }

        

        

        

        $(function(){

            $("dl.menu dt").click(function(){       

                if($(this).parent().find("dd").is(":hidden")) {

                    $(this).find(".ico_down").removeClass("ico_up");

                    $(this).parent().find("dd").show();

                } else {

                    $(this).find(".ico_down").addClass("ico_up");

                    $(this).parent().find("dd").hide();

                }

            }) 

            left_scroll();

            

        })

        

        function left_scroll() {

            var height_left_menu = $("#left_menu_con").height();

            if(height_left_menu > minHeight) {

                $("#left_menu_con").height(minHeight);

                $('#left_menu_con').niceScroll({

                    cursorcolor: "#ccc",//#CC0071 光标颜色

                    cursoropacitymax: 1, //改变不透明度非常光标处于活动状态（scrollabar“可见”状态），范围从1到0

                    touchbehavior: false, //使光标拖动滚动像在台式电脑触摸设备

                    cursorwidth: "5px", //像素光标的宽度

                    cursorborder: "0", // 	游标边框css定义

                    cursorborderradius: "5px",//以像素为光标边界半径

                    autohidemode: false //是否隐藏滚动条

                });

            }

        }

    </script>
    </head>

    <body>
    <table class="main_table">
      <tr class="header">
        <td><div class="logo" onclick="resize_main()"><a >百宝库后台管理</a></div></td>
        <td><ul class="top_menu clearfix">
            <foreach name="top_menu" item="item" key="k">
            <li id="top_menu{$item.menu_id}" > <a href="javascript:void(0)" onclick="show_leftmenu('{$item.menu_id}', '../{$item.menu_link}')">{$item.menu_name}</a> </li>
          </foreach>
          </ul></td>
        <td class="right_nav"><span>您好：{$Think.session.admin_username}</span><a href="{:U('/')}" target="_blank">网站首页</a><a href="javascript:update_cache()" >更新缓存</a><a target="main" href="{:U('changePassword')}" >修改密码</a><a href="{:U('Login/logout')}" >退出管理</a></td>
      </tr>
      <tr>
        <td valign="top"  class="mainer_l"><div id="left_menu_con" class="left_menu_con" style="overflow:hidden;">
            <foreach name="left_menu" item="item">
            <dl class="menu leftmenu_{$item.parent_id}" >
                <dt><span class="ico_down"></span>{$item.menu_name}</dt>
                <foreach name="item.sub" item="sitem">
                <dd><a href="{$sitem.menu_link}" target="{$sitem.target}"><span class="glyphicon {$sitem.ico}"></span>{$sitem.menu_name}</a></dd>
              </foreach>
              </dl>
          </foreach>
          </div></td>
        <td colspan="2"  valign="top" align="left" class="mainer_r"><iframe frameborder="0" name="main" id="main" scrolling="auto"  height="100%" width="100%" src="{$Think.get.url}"></iframe>
          <script type="text/javascript">

                    $(".top_menu li").eq(0).find("a").click();

                    window.setInterval("left_scroll()",500);

                </script></td>
      </tr>
    </table>
</body>
</html>
